﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 纸片人.win2dEffectControl.DataClass
{
    public class BlendEffectData : EffectTwoSourceData
    {
        #region 属性
        BlendEffectMode _mode = BlendEffectMode.Multiply;

        public BlendEffectMode Mode { get => _mode; set { _mode = value; OnPropertyChanged();SetIsChanges(); } }
        #endregion

        public override ICanvasImage GetEffect(CanvasDevice device, bool compression)
        {
            var source = GetSourceEffect(device, compression);
            if (source == null)
            {
                return null;
            }

            var twoSource = GetSourceTwoEffect(device, compression);

            BlendEffect effect = new BlendEffect()
            {
                 Foreground = source,
                 Background = twoSource,
                  Mode = Mode,
            }; 

            return effect;

        }
    }
}
